From 4200936f21d88bd8fc4a71f6a3b067fe3059f79b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jonas=20=C3=85dahl?= Date: Thu, 17 Sep 2020 18:20:08 +0200 Subject: [PATCH] wayland/surface: Make sure to commit ack_configure We must wl_surface.commit after xdg_surface.ack_configure to make it have an effect. We failed to do so when a configure event didn't result in new updates, so make sure we fall back on an simple wl_surface.commit if there was no new actual frame painted. Closes: #2910 --- gdk/wayland/gdkcairocontext-wayland.c | 1 + gdk/wayland/gdkglcontext-wayland.c | 2 ++ gdk/wayland/gdkprivate-wayland.h | 1 + gdk/wayland/gdksurface-wayland.c | 17 +++++++++++++++++ gdk/wayland/gdkvulkancontext-wayland.c | 2 ++ 5 files changed, 23 insertions(+) diff --git a/gdk/wayland/gdkcairocontext-wayland.c b/gdk/wayland/gdkcairocontext-wayland.c index d0fc54d0b0..fcc547ecf6 100644 --- a/gdk/wayland/gdkcairocontext-wayland.c +++ b/gdk/wayland/gdkcairocontext-wayland.c @@ -185,6 +185,7 @@ gdk_wayland_cairo_context_end_frame (GdkDrawContext *draw_context, gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit"); gdk_wayland_surface_commit (surface); + gdk_wayland_surface_notify_committed (surface); gdk_wayland_cairo_context_surface_clear_region (self->paint_surface); self->paint_surface = NULL; diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c index 8ed0bb1d49..a668731196 100644 --- a/gdk/wayland/gdkglcontext-wayland.c +++ b/gdk/wayland/gdkglcontext-wayland.c @@ -261,6 +261,8 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context, } else eglSwapBuffers (display_wayland->egl_display, egl_surface); + + gdk_wayland_surface_notify_committed (surface); } static void diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h index db45a07c08..11c6cefed4 100644 --- a/gdk/wayland/gdkprivate-wayland.h +++ b/gdk/wayland/gdkprivate-wayland.h @@ -95,6 +95,7 @@ guint _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display, void gdk_wayland_surface_sync (GdkSurface *surface); void gdk_wayland_surface_commit (GdkSurface *surface); +void gdk_wayland_surface_notify_committed (GdkSurface *surface); void gdk_wayland_surface_request_frame (GdkSurface *surface); void gdk_wayland_surface_attach_image (GdkSurface *surface, cairo_surface_t *cairo_surface, diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index bda30ae39c..aee98a2d48 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -94,6 +94,7 @@ struct _GdkWaylandSurface PopupState popup_state; unsigned int initial_configure_received : 1; + unsigned int has_uncommitted_ack_configure : 1; unsigned int mapped : 1; unsigned int awaiting_frame : 1; unsigned int awaiting_frame_frozen : 1; @@ -622,12 +623,26 @@ gdk_wayland_surface_commit (GdkSurface *surface) wl_surface_commit (impl->display_server.wl_surface); } +void +gdk_wayland_surface_notify_committed (GdkSurface *surface) +{ + GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface); + + impl->has_uncommitted_ack_configure = FALSE; +} + static void on_frame_clock_after_paint (GdkFrameClock *clock, GdkSurface *surface) { GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface); + if (surface->update_freeze_count == 0 && impl->has_uncommitted_ack_configure) + { + gdk_wayland_surface_commit (surface); + gdk_wayland_surface_notify_committed (surface); + } + if (impl->awaiting_frame && impl->pending_frame_counter == gdk_frame_clock_get_frame_counter (clock)) { @@ -1458,6 +1473,8 @@ gdk_wayland_surface_configure (GdkSurface *surface) impl->pending.is_initial_configure = TRUE; } + impl->has_uncommitted_ack_configure = TRUE; + if (is_realized_popup (surface)) gdk_wayland_surface_configure_popup (surface); else if (is_realized_toplevel (surface)) diff --git a/gdk/wayland/gdkvulkancontext-wayland.c b/gdk/wayland/gdkvulkancontext-wayland.c index fa2f89c8d8..ee88e8e66c 100644 --- a/gdk/wayland/gdkvulkancontext-wayland.c +++ b/gdk/wayland/gdkvulkancontext-wayland.c @@ -69,6 +69,8 @@ gdk_vulkan_context_wayland_end_frame (GdkDrawContext *context, gdk_wayland_surface_request_frame (surface); GDK_DRAW_CONTEXT_CLASS (gdk_wayland_vulkan_context_parent_class)->end_frame (context, painted); + + gdk_wayland_surface_notify_committed (surface); } static void -- 2.30.2